﻿Imports System.Text

Public MustInherit Class CSAbstractRenderEngine
    Inherits AbstractRenderEngine

    Public Sub New(ByVal u As UpdateProgress, ByVal s As UpdateStatus, ByVal fileParser As Type)
        MyBase.New(u, s, fileParser)
    End Sub

    Protected Overrides Function RenderRegionEnd() As String
        Return "#endregion" & vbCrLf
    End Function

    Protected Overrides Function RenderRegionStart() As String
        Return "#region ""BizBlox Generated Code""" & vbCrLf
    End Function

    Protected Overrides Function FormatFiletype() As String
        Return ".cs"
    End Function

    Protected Overrides Function FormatComment() As String
        Return "//"
    End Function

    ''' <summary>
    ''' Render a list of Attributes for a class or method
    ''' </summary>
    ''' <param name="attributes"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Protected Overrides Function RenderAttributes(ByVal attributes As Attribute()) As String
        If attributes.Length = 0 Then
            Return ""
        Else
            Dim sb As New StringBuilder
            sb.Append("    [")
            For i As Integer = 0 To attributes.Length - 1
                sb.Append(attributes(i).Name & "(" & attributes(i).ArgumentsString & ")")
                If i <> attributes.Length - 1 Then
                    sb.Append(", ")
                End If
            Next
            sb.Append("]" & vbCrLf)
            Return sb.ToString()
        End If
    End Function

End Class
